<?php
class phongdb{
	public function Them($MaPhong, $LoaiPhong, $LoaiGiuong, $GiaPhong, $TinhTrang){
		$data = new dataservice;
		$sql = "INSERT INTO `phong`(`MaPhong`, `LoaiPhong`, `LoaiGiuong`, `GiaPhong`, `TinhTrang`)"
			+ "VALUES($MaPhong, $LoaiPhong, $LoaiGiuong, $GiaPhong, $TinhTrang)";
		return $data -> ExecuteNoneQuery($sql);	
	}
	
	public function Xoa($MaPhong){
		$data = new dataservice;
		$sql = "DELETE FROM `phong` WHERE MaPhong = $MaPhong ";
		return $data->ExecuteNoneQuery($sql);
	}
	
	public function CapNhatGia($MaPhong, $GiaPhong){
		$data = new dataservice;
		$sql = "UPDATE `phong` SET GiaPhong=$GiaPhong WHERE MaPhong=$MaPhong";
		return $data->ExecuteNoneQuery($sql);
	}
	
	public function CapNhat($MaPhong, $TinhTrang){
		$data = new dataservice;
		$sql = "UPDATE `phong` SET TinhTrang=$TinhTrang WHERE MaPhong=$MaPhong";
		return $data->ExecuteNoneQuery($sql);		
	}
	
	public function LayDanhSach($TinhTrang){
		$data = new dataservice;
		$sql = "SELECT * FROM `phong` WHERE TinhTrang=$TinhTrang";
		return $data->ExecuteQuery($sql);
	}
}
?>